<?php
require_once("../db/db_connector.php");
require_once("../db/db_picture.php");

// Database Access Begins ---------------------------------------- //
$con = get_db_con();
$picture_list = get_picture_list($con);
close_db_con();
// Database Access Ends ------------------------------------------ //

?>

<?php
include_once("../include/admin_header.php");
?>

<h2>Picture</h2>
<a href="picture_edit.php">Create Picture</a>
<table>
	<tr>
		<th>id</th>
		<th>title</th>
		<th>description</th>
		<th>paradise_id</th>
		<th>user_id</th>
		<th>url</th>
		<th>thumb_small</th>
	</tr>
<?php foreach ($picture_list as $picture): ?>
	<tr>
		<td><?=$picture["id"]?></td>
		<td><?=$picture["title"]?></td>
		<td><?=$picture["description"]?></td>
		<td><?=$picture["paradise_id"]?></td>
		<td><?=$picture["user_id"]?></td>
		<td><?=$picture["url"]?></td>
		<td>
			<a href="<?=$picture["url"]?>" target="_blank">
				<img src="<?=$picture["thumb_small"]?>" />
			</a>
		</td>
	</tr>
<?php endforeach ?>
</table>

<?php
include_once("../include/admin_footer.php");
?>
